home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Languages / MPW Oberon 2.1168 / OInterfaces / CursorDevices.mod < prev    next >
Encoding:
Text File  |  1995-08-10  |  7.5 KB  |  189 lines  |  [TEXT/MPS ]

  1. (*
  2.      File:        CursorDevices.mod
  3.  
  4.      Contains:    Cursor Devices (mouse/trackball/etc) Interfaces.
  5.  
  6.      Version:    Technology:    System 7.5
  7.                  Package:    Universal Interfaces 2.0 in “MPW Latest” on ETO #17
  8.  
  9.      Copyright:    © 1984-1995 by Apple Computer, Inc.
  10.                  All rights reserved.
  11.  
  12.      Bugs?:        If you find a problem with this file, use the Apple Bug Reporter
  13.                  stack.  Include the file and version information (from above)
  14.                  in the problem description and send to:
  15.                      Internet:    apple.bugs.applelink.apple.com
  16.                      AppleLink:    APPLE.BUGS
  17.  
  18. *)
  19.  
  20. (*$TAGS-*)
  21. (*$CALLING PASCAL*)
  22. MODULE CursorDevices;
  23.  
  24. IMPORT SYSTEM, Types;
  25.  
  26. (* $PUSH*)
  27. (* $ALIGN MAC68K*)
  28. (* $LibExport+*)
  29. (*
  30.                        * * *  W A R N I N G  * * * 
  31.  
  32.     On currently shipping PowerMacs, the CursorDevices manager is implemented
  33.     in 68K code and emulated.  Unfortunately, the MixedMode glue in InterfaceLib
  34.     is incorrect.  It and the 1.0 version of this file had incorrect parameter
  35.     lists for most functions.
  36.     
  37.     As a first step to avoid runtime errors, the functions in this file were 
  38.     renamed (e.g. from"CrsrDevButtons" to "CursorDeviceButtons").  This will result
  39.     in a link time error if a PowerPC application tries to call the functions.
  40.     When InterfaceLib is fixed, the new names will be exported and PowerPC
  41.     code will then be able to call them.
  42.     
  43. *)
  44.     
  45. TYPE
  46.     ButtonOpcode* = INTEGER;
  47.  
  48. (* ButtonOpcodes *)
  49.  
  50. CONST
  51.     kButtonNoOp*                    = 0;                            (* No action for this button *)
  52.     kButtonSingleClick*            = 1;                            (* Normal mouse button *)
  53.     kButtonDoubleClick*            = 2;                            (* Click-release-click when pressed *)
  54.     kButtonClickLock*            = 3;                            (* Click on press, release on next press *)
  55.     kButtonCustom*                = 6;                            (* Custom behavior, data* = CursorDeviceCustomButtonUPP *)
  56.  
  57. (* Device Classes *)
  58.     kDeviceClassAbsolute*        = 0;                            (* a flat-response device *)
  59.     kDeviceClassMouse*            = 1;                            (* mechanical or optical mouse *)
  60.     kDeviceClassTrackball*        = 2;                            (* trackball *)
  61.     kDeviceClass3D*                = 6;                            (* a 3D pointing device *)
  62.  
  63. (* Structures used in Quickdraw.Cursor Device Manager calls *)
  64.  
  65. TYPE
  66.     CursorDataPtr* = POINTER TO CursorData;
  67.     CursorData* = RECORD
  68.         nextCursorData*:            CursorDataPtr (*ΔΔ POINTER TO CursorData*);                            (* next in global list *)
  69.         displayInfo*:            Types.Ptr;                                    (* unused (reserved for future) *)
  70.         whereX*:                    Types.Fixed;                                    (* horizontal position *)
  71.         whereY*:                    Types.Fixed;                                    (* vertical position *)
  72.         where*:                    Types.Point;                                    (* the pixel position *)
  73.         isAbs*:                    BOOLEAN;                                (* has been stuffed with absolute coords *)
  74.         buttonCount*:            Types.SInt8; (* UInt8 *)                        (* number of buttons currently pressed *)
  75.         screenRes*:                INTEGER;                                (* pixels per inch on the current display *)
  76.         privateFields*:            ARRAY 22 (*ΔΔ[0..21]ΔΔ*) OF INTEGER;                (* fields use internally by CDM *)
  77.     END;
  78.  
  79.     CursorDevicePtr* = POINTER TO CursorDevice;
  80.  
  81.     CursorDevice* = RECORD
  82.         nextCursorDevice*:        CursorDevicePtr (*ΔΔ POINTER TO CursorDevice*);                            (* pointer to next record in linked list *)
  83.         whichCursor*:            CursorDataPtr (*ΔΔ POINTER TO CursorData*);                            (* pointer to data for target cursor *)
  84.         refCon*:                    LONGINT;                                (* application-defined *)
  85.         unused*:                    LONGINT;                                (* reserved for future *)
  86.         devID*:                    Types.OSType;                                    (* device identifier (from ADB reg 1) *)
  87.         resolution*:                Types.Fixed;                                    (* units/inch (orig. from ADB reg 1) *)
  88.         devClass*:                Types.SInt8; (* UInt8 *)                        (* device class (from ADB reg 1) *)
  89.         cntButtons*:                Types.SInt8; (* UInt8 *)                        (* number of buttons (from ADB reg 1) *)
  90.         filler1*:                Types.SInt8; (* UInt8 *)                        (* reserved for future *)
  91.         buttons*:                Types.SInt8; (* UInt8 *)                        (* state of all buttons *)
  92.         buttonOp*:                ARRAY 8 (*ΔΔ[0..7]ΔΔ*) OF Types.SInt8; (* UInt8 *)        (* action performed per button *)
  93.         buttonTicks*:            ARRAY 8 (*ΔΔ[0..7]ΔΔ*) OF LONGINT;                (* ticks when button last went up (for debounce) *)
  94.         buttonData*:                ARRAY 8 (*ΔΔ[0..7]ΔΔ*) OF LONGINT;                (* data for the button operation *)
  95.         doubleClickTime*:        LONGINT;                                (* device-specific double click speed *)
  96.         acceleration*:            Types.Fixed;                                    (* current acceleration *)
  97.         privateFields*:            ARRAY 15 (*ΔΔ[0..14]ΔΔ*) OF INTEGER;                (* fields used internally to CDM *)
  98.     END;
  99.  
  100.  
  101. (* for use with CursorDeviceButtonOp when opcode* = kButtonCustom *)
  102.     (*
  103.         CursorDeviceCustomButtonProcPtr uses register based parameters on the 68k and cannot
  104.         be written in or called from a high-level language without the help of
  105.         mixed mode or assembly glue.
  106.  
  107.         In*:
  108.          => ourDevice       A2.L
  109.          => button          D3.W
  110.     *)
  111.     CursorDeviceCustomButtonProcPtr* = Types.Register68kProcPtr;  (* register PROCEDURE CursorDeviceCustomButton*(ourDevice: CursorDevicePtr; button*: INTEGER); *)
  112.     CursorDeviceCustomButtonUPP* = Types.UniversalProcPtr;
  113.  
  114. CONST
  115.     uppCursorDeviceCustomButtonProcInfo* = $000ED802; (* Register PROCEDURE (4 bytes in A2, 2 bytes in D3); *)
  116.  
  117. PROCEDURE NewCursorDeviceCustomButtonProc*(userRoutine: CursorDeviceCustomButtonProcPtr): CursorDeviceCustomButtonUPP;
  118.     (*$IF NOT GENERATINGCFM *)
  119.     INLINE PASCAL $2E9F;
  120.     (*$END*)
  121.  
  122. PROCEDURE CallCursorDeviceCustomButtonProc*(ourDevice: CursorDevicePtr; button: INTEGER; userRoutine: CursorDeviceCustomButtonUPP);
  123.     (*$IF NOT GENERATINGCFM*)
  124.     INLINE PASCAL ; (*••*)
  125.     (*To be implemented:  Glue to move parameters into registers.*)
  126.     (*$END*)
  127.  
  128. PROCEDURE CursorDeviceMove*(ourDevice: CursorDevicePtr; deltaX: LONGINT; deltaY: LONGINT): Types.OSErr;
  129.     (*$IF NOT GENERATINGCFM*)
  130.     INLINE PASCAL $7000, $AADB;
  131.     (*$END*)
  132. PROCEDURE CursorDeviceMoveTo*(ourDevice: CursorDevicePtr; absX: LONGINT; absY: LONGINT): Types.OSErr;
  133.     (*$IF NOT GENERATINGCFM*)
  134.     INLINE PASCAL $7001, $AADB;
  135.     (*$END*)
  136. PROCEDURE CursorDeviceFlush*(ourDevice: CursorDevicePtr): Types.OSErr;
  137.     (*$IF NOT GENERATINGCFM*)
  138.     INLINE PASCAL $7002, $AADB;
  139.     (*$END*)
  140. PROCEDURE CursorDeviceButtons*(ourDevice: CursorDevicePtr; buttons: INTEGER): Types.OSErr;
  141.     (*$IF NOT GENERATINGCFM*)
  142.     INLINE PASCAL $7003, $AADB;
  143.     (*$END*)
  144. PROCEDURE CursorDeviceButtonDown*(ourDevice: CursorDevicePtr): Types.OSErr;
  145.     (*$IF NOT GENERATINGCFM*)
  146.     INLINE PASCAL $7004, $AADB;
  147.     (*$END*)
  148. PROCEDURE CursorDeviceButtonUp*(ourDevice: CursorDevicePtr): Types.OSErr;
  149.     (*$IF NOT GENERATINGCFM*)
  150.     INLINE PASCAL $7005, $AADB;
  151.     (*$END*)
  152. PROCEDURE CursorDeviceButtonOp*(ourDevice: CursorDevicePtr; buttonNumber: INTEGER; opcode: ButtonOpcode; data: LONGINT): Types.OSErr;
  153.     (*$IF NOT GENERATINGCFM*)
  154.     INLINE PASCAL $7006, $AADB;
  155.     (*$END*)
  156. PROCEDURE CursorDeviceSetButtons*(ourDevice: CursorDevicePtr; numberOfButtons: INTEGER): Types.OSErr;
  157.     (*$IF NOT GENERATINGCFM*)
  158.     INLINE PASCAL $7007, $AADB;
  159.     (*$END*)
  160. PROCEDURE CursorDeviceSetAcceleration*(ourDevice: CursorDevicePtr; acceleration: Types.Fixed): Types.OSErr;
  161.     (*$IF NOT GENERATINGCFM*)
  162.     INLINE PASCAL $7008, $AADB;
  163.     (*$END*)
  164. PROCEDURE CursorDeviceDoubleTime*(ourDevice: CursorDevicePtr; durationTicks: LONGINT): Types.OSErr;
  165.     (*$IF NOT GENERATINGCFM*)
  166.     INLINE PASCAL $7009, $AADB;
  167.     (*$END*)
  168. PROCEDURE CursorDeviceUnitsPerInch*(ourDevice: CursorDevicePtr; resolution: Types.Fixed): Types.OSErr;
  169.     (*$IF NOT GENERATINGCFM*)
  170.     INLINE PASCAL $700A, $AADB;
  171.     (*$END*)
  172. PROCEDURE CursorDeviceNextDevice*(VAR ourDevice: CursorDevicePtr): Types.OSErr;
  173.     (*$IF NOT GENERATINGCFM*)
  174.     INLINE PASCAL $700B, $AADB;
  175.     (*$END*)
  176. PROCEDURE CursorDeviceNewDevice*(VAR ourDevice: CursorDevicePtr): Types.OSErr;
  177.     (*$IF NOT GENERATINGCFM*)
  178.     INLINE PASCAL $700C, $AADB;
  179.     (*$END*)
  180. PROCEDURE CursorDeviceDisposeDevice*(ourDevice: CursorDevicePtr): Types.OSErr;
  181.     (*$IF NOT GENERATINGCFM*)
  182.     INLINE PASCAL $700D, $AADB;
  183.     (*$END*)
  184.  
  185. (* $ALIGN RESET*)
  186. (* $POP*)
  187.  
  188.  END CursorDevices.
  189.